package com.cgc.venus.server.user.controller;

import com.cgc.venus.server.core.bean.page.PageQuery;
import com.cgc.venus.server.core.bean.response.VenusResponse;
import com.cgc.venus.server.core.bean.response.VenusResponseStatus;
import com.cgc.venus.server.core.exception.VenusException;
import com.cgc.venus.server.core.utils.DateUtil;
import com.cgc.venus.server.core.utils.StringUtil;
import com.cgc.venus.server.user.bean.UserBean;
import com.cgc.venus.server.user.inter.UserService;
import io.swagger.annotations.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.sql.Timestamp;
import java.util.*;

/**
 * Created by xyr on 2017/6/3.
 */
@Api(value = "用户维护", description = "用户维护所对应服务的api")
@RequestMapping("/user-admin")
@RestController
public class UserController {

    @Autowired
    private UserService userService;


    /*
    * 登录功能
    * @param loginName 登录账号
    * @param loginPassword 登录密码
    * */
    @ApiOperation(value = "登录接口", notes = "根据账号名和密码,登录系统:loginName,loginPassword")
    @RequestMapping(value = "/login", method = RequestMethod.POST)
    public VenusResponse<Object> login(@ApiParam("登录功能") @RequestBody UserBean userBean) throws VenusException {
        String loginName = userBean.getLoginName();
        String loginPassword = userBean.getLoginPassword();
        // 账号非空判断
        if (StringUtils.isBlank(loginName))
            throw new VenusException(VenusResponseStatus.NO_CONTENT, "用户信息为空");
        // 密码非空判断
        if (StringUtils.isBlank(loginPassword))
            throw new VenusException(VenusResponseStatus.NO_CONTENT, "登录密码为空");

        // 判断用户是否存在
        String userId = userService.getUserId(loginName, loginPassword);
        int code = VenusResponseStatus.USER_NOT_FOUND;
        Map<String, String> dataMap = new HashMap<String, String>();
        // 用户存在
        if (StringUtils.isNotBlank(userId)) {
            // 更新用户表的session时间,token信息
            String token = StringUtil.getUUID();
            int register_int = userService.register(loginName, token);
            code = register_int >= 1 ? VenusResponseStatus.OK : VenusResponseStatus.USER_NOT_FOUND;
            // 将token,返回给客户端
            dataMap.put("token", token);
        }

        // 登陆失败
        if (code == VenusResponseStatus.ACCOUNT_NOT_FOUND) {
            throw new VenusException(VenusResponseStatus.USER_NOT_FOUND,"登陆失败,用户:" + loginName + ",不存在");
        }

        VenusResponse<Object> venusResponse = new VenusResponse<Object>(code, "登录成功,欢迎您", dataMap);
        return venusResponse;
    }

    /*
    * 登出
    * */
    @ApiOperation(value = "退出登录接口", notes = "根据登录token登出系统")
    @RequestMapping(value = "/logout", method = RequestMethod.PATCH)
    public VenusResponse<String> logout(@ApiParam("token") @RequestBody UserBean userBean) throws VenusException {
        String token = userBean.getToken();
        // 非空判断
        if (StringUtils.isBlank(token))
            throw new VenusException(VenusResponseStatus.NO_CONTENT, "验证token为空");
        // 清除登录信息
        int row = userService.logout(token);
        int code = row > 0 ? VenusResponseStatus.OK : VenusResponseStatus.INTERNAL_SERVER_ERROR;
        VenusResponse<String> venusResponse = new VenusResponse<String>(code, "", "");
        return venusResponse;
    }

    /*
    * 根据登录token,判断token是否存在,并且session是否过期
    * @return code=401 session过期,token找不到
    * @return code=200 验证通过
    * */
    @ApiOperation(value = "token验证接口", notes = "根据登录token,判断token是否存在,并且session是否过期")
    @RequestMapping(value = "/validateToken/{token}", method = RequestMethod.GET)
    public VenusResponse<String> validateToken(@ApiParam("token参数") @PathVariable("token") String token) throws VenusException {
        // 非空判断
        if (StringUtils.isBlank(token))
            throw new VenusException(VenusResponseStatus.NO_CONTENT, "验证token为空");

        // 返回的状态码,默认返回401,token找不到
        int code = VenusResponseStatus.UNAUTHORIZED;
        String message = "";

        // 1: 判断是否存在token,并返回用户信息
        Map<String, Object> tokenMap = userService.validateToken(token);

        // 2: 存在token
        if (tokenMap.size() > 0) {
            // 得到session有效时间
            int session_expire_time = (Integer) tokenMap.get("session_expire_time");
            // 得到登录时间
            Timestamp login_time = (Timestamp) tokenMap.get("login_time");
            // 得到当前时间
            long currentTime = new Date().getTime();
            // 计算时间差
            int timeDiff = DateUtil.countTimeDifference(login_time.getTime(), currentTime);
            // 401 session失效
            // 200 没失效
            code = timeDiff > session_expire_time ? VenusResponseStatus.UNAUTHORIZED : VenusResponseStatus.OK;

            // 更新登录的时间
            if (code == VenusResponseStatus.OK) {
                int row = userService.updateLoginTime(token);
                code = row > 0 ? VenusResponseStatus.OK : VenusResponseStatus.UNAUTHORIZED;
            }
        }
        VenusResponse<String> venusResponse = new VenusResponse<String>(code, message, "");
        return venusResponse;
    }

    /*
    * 判断账号是否存在
    * */
    @ApiOperation(value = "系统账号验证接口", notes = "根据输入账号,判断登录账号是否存在")
    @RequestMapping(value = "/validateAccount", method = RequestMethod.POST)
    public VenusResponse<String> validateAccount(@ApiParam("登录账号参数") @RequestBody UserBean userBean) throws VenusException {
        String loginName = userBean.getLoginName();
        // 非空判断
        if (StringUtils.isBlank(loginName))
            throw new VenusException(VenusResponseStatus.NO_CONTENT, "验证账号为空");
        // 查询
        int result = userService.validateAccount(loginName);
        int code = result == 0 ? VenusResponseStatus.ACCOUNT_NOT_FOUND : VenusResponseStatus.OK;

        /*if (code != VenusResponseStatus.OK) {
            throw new VenusException(code,"登陆账号:" + userBean.getLoginName() + ",不存在");
        }*/

        VenusResponse<String> venusResponse = new VenusResponse<String>(VenusResponseStatus.OK, "", String.valueOf(code));
        return venusResponse;
    }

    /*
    * 判断密码是否正确
    * */
    @ApiOperation(value = "登录密码验证接口", notes = "根据输入登录账号和密码,验证是否正确")
    @RequestMapping(value = "/validatePassword", method = RequestMethod.POST)
    public VenusResponse<String> validatePassword(@RequestBody UserBean userBean) throws VenusException {
        String loginName = userBean.getLoginName();
        String loginPassword = userBean.getLoginPassword();
        // 账号非空判断
        if (StringUtils.isBlank(loginName))
            throw new VenusException(VenusResponseStatus.NO_CONTENT, "用户信息为空");
        // 密码非空判断
        if (StringUtils.isBlank(loginPassword))
            throw new VenusException(VenusResponseStatus.NO_CONTENT, "登录密码为空");
        // 查询
        String result = userService.getUserId(loginName, loginPassword);
        int code = StringUtils.isBlank(result) ? VenusResponseStatus.PASSWORD_NOT_FOUND : VenusResponseStatus.OK;
        VenusResponse<String> venusResponse = new VenusResponse<String>(VenusResponseStatus.OK, "", String.valueOf(code));
        return venusResponse;
    }


    /*
    * 测试权限接口,这里功能没实现
    * */
    /*@ApiOperation("测试权限接口")
    @RequestMapping(value = "/info", method = RequestMethod.POST)
    public VenusResponse<Object> info() {
        Map<String, Object> dataMap = new HashMap<String, Object>();
        List<String> list = new ArrayList<String>();
        list.add("admin");
        dataMap.put("avatar", "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
        dataMap.put("name", "admin");
        dataMap.put("role", list);
        VenusResponse<Object> venusResponse = new VenusResponse<Object>(200, "success", dataMap);
        return venusResponse;
    }*/


    /*
    * 测试权限接口,这里功能没实现
    *
    {
        "data": {
            "userId": "111111111111",
            "email": "1234@qq.com",
            "isSuperAdmin": 1,
            "loginName": "admin",
            "phone": "12345678909",
            "roleName": "超级用户",
            "rolePermission": "/home,/home/index,/login",
            "userName": "真实名称"
        },
        "meta": {
            "code": 200,
            "message": "success"
        }
    }

    * */
    @ApiOperation("获得登录用户的权限信息接口")
    @RequestMapping(value = "/permission/{token}", method = RequestMethod.GET)
    public VenusResponse<Object> getUserInfo(@PathVariable("token") String token) throws VenusException{
        // 非空判断
        if (StringUtils.isBlank(token))
            throw new VenusException(VenusResponseStatus.NO_CONTENT, "验证token为空");

        // 状态码,默认401,非法登录,非法获得用户信息
        int code = VenusResponseStatus.UNAUTHORIZED;
        String message = "非法登录,获得用户信息失败";

        // 功能url
        StringBuilder sb = new StringBuilder();
        // 1: 获得用户信息
        Map<String,Object> userResultMap = userService.getUserByToken(token);

        if (userResultMap.size() > 0) {
            // 2: 根据角色功能列表获得功能菜单url
            // 先判断当前登录用户是否超级管理员
            int isSuperAdmin = (Integer) userResultMap.get("isSuperAdmin");
            if (isSuperAdmin == 0) {
                // 得到功能菜单ID列表
                String functionIds = (String) userResultMap.get("rolePermission");
                functionIds = functionIds.replaceAll("\"","").replaceAll("\\[","").replaceAll("\\]","");
                String[] idsArr = functionIds.split(",");
                int idsArrLen = idsArr.length;
                // 获得功能url
                for (int i = 0; i < idsArrLen; i++) {
                    // 得到功能信息的url
                    Map<String,Object> functionMap = userService.getFunctionById(idsArr[i]);
                    if (functionMap.size() > 0) {
                        String url = (String) functionMap.get("url");
                        sb.append(url);
                        sb.append(",");
                    }
                }
                // 功能菜单url
                userResultMap.put("rolePermission",sb.toString());
            }
            code = VenusResponseStatus.OK;
            message = "";
        }
        VenusResponse<Object> venusResponse = new VenusResponse<Object>(code, message , userResultMap);
        return venusResponse;
    }

    /*
    * 新增用户接口
    * */
    @ApiOperation(value = "新增用户接口", notes = "新增用户")
    @RequestMapping(value = "/user", method = RequestMethod.POST)
    public VenusResponse<Object> addUser(@RequestBody UserBean userBean) throws VenusException {
        // 非空校验
        if (StringUtils.isBlank(userBean.getLoginName()))
            throw new VenusException(VenusResponseStatus.NO_CONTENT, "登录账号为空");
        if (StringUtils.isBlank(userBean.getLoginPassword()))
            throw new VenusException(VenusResponseStatus.NO_CONTENT, "登录密码为空");

        if (StringUtils.isBlank(userBean.getName()))
            throw new VenusException(VenusResponseStatus.NO_CONTENT, "真实名字为空");

        if (StringUtils.isBlank(userBean.getPhone()))
            throw new VenusException(VenusResponseStatus.NO_CONTENT, "电话为空");
        if (StringUtils.isBlank(userBean.getEmail()))
            throw new VenusException(VenusResponseStatus.NO_CONTENT, "邮件为空");

        if (StringUtils.isBlank(userBean.getRole()))
            throw new VenusException(VenusResponseStatus.NO_CONTENT, "角色ID为空");
        if (userBean.getSessionExpireTime() == 0)
            throw new VenusException(VenusResponseStatus.NO_CONTENT, "登录时长为空");

        // 业务逻辑
        // 生成用户ID
        String userId = StringUtil.getUUID();
        userBean.setId(userId);

        // 调用dao层方法
        int row = userService.addUser(userBean);

        int code = VenusResponseStatus.HANDLE_ERROR;
        String messages = "新增用户:"+userBean.getLoginName()+",失败";
        if (row > 0) {
            code = VenusResponseStatus.OK;
            messages = "新增用户:"+userBean.getLoginName()+",成功";
        } else {
            throw new VenusException(code,messages);
        }
        VenusResponse<Object> venusResponse = new VenusResponse<Object>(code, messages, "");
        return venusResponse;
    }

    /*
    * 根据账号名字,修改用户信息
    * */
    @ApiOperation(value = "修改用户信息接口", notes = "修给用户信息")
    @RequestMapping(value = "/user", method = RequestMethod.PATCH)
    public VenusResponse<Object> updateUser(@RequestBody UserBean userBean) throws VenusException {
        // 非空校验
        if (StringUtils.isBlank(userBean.getLoginName()))
            throw new VenusException(VenusResponseStatus.NO_CONTENT, "登录账号为空");
        if (StringUtils.isBlank(userBean.getLoginPassword()))
            throw new VenusException(VenusResponseStatus.NO_CONTENT, "登录密码为空");

        if (StringUtils.isBlank(userBean.getName()))
            throw new VenusException(VenusResponseStatus.NO_CONTENT, "真实名字为空");

        if (StringUtils.isBlank(userBean.getPhone()))
            throw new VenusException(VenusResponseStatus.NO_CONTENT, "电话为空");
        if (StringUtils.isBlank(userBean.getEmail()))
            throw new VenusException(VenusResponseStatus.NO_CONTENT, "邮件为空");

        if (StringUtils.isBlank(userBean.getRole()))
            throw new VenusException(VenusResponseStatus.NO_CONTENT, "角色ID为空");
        if (userBean.getSessionExpireTime() == 0)
            throw new VenusException(VenusResponseStatus.NO_CONTENT, "登录时长为空");

        // 修改数据
        int row = userService.updateUser(userBean);
        int code = VenusResponseStatus.HANDLE_ERROR;
        String message = "修改用户:"+userBean.getLoginName()+",信息失败";

        if (row > 0) {
            code = VenusResponseStatus.OK;
            message = "修改用户:"+userBean.getLoginName()+"信息成功";
        } else {
            throw new VenusException(code,message);
        }
        VenusResponse<Object> venusResponse = new VenusResponse<Object>(code, message, "");
        return venusResponse;
    }

    /*
    * 根据用户ID删除用户信息
    * */
    @ApiOperation(value = "删除用户信息接口", notes = "删除用户信息")
    @RequestMapping(value = "/user/{id}", method = RequestMethod.DELETE)
    public VenusResponse<Object> deleteUser(@PathVariable("id") String id) throws VenusException {
        // 非空校验
        if (StringUtils.isBlank(id))
            throw new VenusException(VenusResponseStatus.NO_CONTENT, "用户ID为空");

        int code = VenusResponseStatus.HANDLE_ERROR;
        String message = "删除用户信息失败";

        // 增加删除判断
        // 1: 该用户分配了团队,不能删除
        // 2: 该用户分配了空间,不能删除
        // int row = userService.deleteUserById(id);

        List<Map<String,Object>> resultList = userService.getTeamByUserId(id);

        if (resultList.size() > 0) {
            // 该用户分配了团队,不能删除
            code = VenusResponseStatus.FOREIGN_DELETE_TEAM_BY_USER;
            message = "该用户分配了团队,不能删除";
        } else {
            resultList = userService.getNamespaceByUserId(id);
            if (resultList.size() > 0) {
                // 该用户分配了空间,不能删除
                code = VenusResponseStatus.FOREIGN_DELETE_NAMESPACE_BY_USER;
                message = "该用户分配了空间,不能删除";
            } else {
                // 删除
                int row = userService.deleteUserById(id);
                code = VenusResponseStatus.OK;
                message = "成功删除用户信息";
            }
        }

        if (code != VenusResponseStatus.OK) {
            throw new VenusException(code,message);
        }

        /*if (row > 0) {
            code = VenusResponseStatus.OK;
            message = "成功删除用户信息";
        }*/
        VenusResponse<Object> response = new VenusResponse<Object>(code, message, "");
        return response;
    }


    /*
    * 用户基本信息查询: 查询字段 login_name, name
    * */
    @ApiOperation(value = "用户基本信息查询接口", notes = "查询关键字 login_name, name")
    @RequestMapping(value = "/user", method = RequestMethod.GET)
    public VenusResponse<Object> queryUser(@RequestParam("page") int page,@RequestParam("pageSize") int pageSize,@RequestParam("queryKey") String queryKey) throws VenusException {
        List<Map<String, Object>> resultList = new ArrayList<Map<String, Object>>();
        // 新增查询类
        PageQuery pageQuery = new PageQuery();
        pageQuery.setPage(page);
        pageQuery.setPageSize(pageSize);
        pageQuery.setQueryKey(queryKey);

        long total = 0;
        if (StringUtils.isBlank(queryKey)) {
            // 如果查询关键字为空,则默认查询全部
            resultList = userService.queryAllUser(page, pageSize);
        } else {
            // 否则根据关键字进行模糊查询
            resultList = userService.queryUserByKey(pageQuery);
        }
        int code = VenusResponseStatus.OK;
        //String message = "没有找到相关的用户信息";
        Map<String, Object> dataMap = new HashMap<String, Object>();

        if (resultList.size() > 0) {
            total = userService.countAllUser(pageQuery);
            //message = "";
        }
        dataMap.put("total", total);
        dataMap.put("items", resultList);
        VenusResponse<Object> venusResponse = new VenusResponse<Object>(code, "", dataMap);
        return venusResponse;
    }

    /*
    * 根据用户ID,修改用户密码
    * */
    @ApiOperation(value = "修改用户密码接口", notes = "根据用户ID,修改用户密码")
    @RequestMapping(value = "/password", method = RequestMethod.PATCH)
    public VenusResponse<String> updatePassword(@RequestBody UserBean userBean ) throws VenusException {
        // 非空校验
        if (StringUtils.isBlank(userBean.getId()))
            throw new VenusException(VenusResponseStatus.NO_CONTENT, "用户ID为空");

        if (StringUtils.isBlank(userBean.getLoginPassword()))
            throw new VenusException(VenusResponseStatus.NO_CONTENT, "新密码为空");

        int code = VenusResponseStatus.HANDLE_ERROR;
        String message = "修改用户密码,失败";

        int row = userService.updatePasswordById(userBean.getId(),userBean.getLoginPassword());

        if (row > 0) {
            code = VenusResponseStatus.OK;
            message = "修改用户密码,成功";
        } else {
            throw new VenusException(code,message);
        }

        VenusResponse<String> response = new VenusResponse<String>(code,message,"");
        return response;
    }

    /*
    *  根据用户ID，获得对应的团队信息
    * */
    @ApiOperation(value = "获得用户对应的团队信息填充选择下拉框接口", notes = "用户ID,是否超级管理员")
    @RequestMapping(value = "/team/combobox", method = RequestMethod.GET)
    public VenusResponse<Object> getTeamCombobox(@RequestParam("currentUserId") String currentUserId,
                                                  @RequestParam("isSuperAdmin") int isSuperAdmin) throws VenusException {
        List<Map<String,Object>> maps = userService.getTeamCombobox(currentUserId,isSuperAdmin);
        VenusResponse<Object> response = new VenusResponse<Object>(VenusResponseStatus.OK,"",maps);
        return response;
    }

    /*
    * 根据团队ID，获得空间信息，填充选择下拉框
    * */
    @ApiOperation(value = "根据团队ID，获得空间信息，填充选择下拉框接口", notes = "团队ID")
    @RequestMapping(value = "/namespace/combobox", method = RequestMethod.GET)
    public VenusResponse<Object> getNamespaceCombobox(@RequestParam("teamId") String teamId,
                                                      @RequestParam("userId") String userId,
                                                      @RequestParam("isSuperAdmin") int isSuperAdmin) throws VenusException {
        List<Map<String,Object>> maps = userService.getNamespaceCombobox(teamId,userId,isSuperAdmin);
        VenusResponse<Object> response = new VenusResponse<Object>(VenusResponseStatus.OK,"",maps);
        return response;
    }

    /*
    * 得到用户的空间信息
    * */
    @ApiOperation(value = "得到用户的空间信息", notes = "用户ID,是否超级管理员")
    @RequestMapping(value = "/namespace/base", method = RequestMethod.GET)
    public VenusResponse<Object> getNamespaceBase(@RequestParam("userId") String userId,@RequestParam("superAdmin") int superAdmin) throws VenusException {
        if (StringUtils.isBlank(userId))
            throw new VenusException(VenusResponseStatus.NO_CONTENT, "用户ID为空");

        // 获取空间团队,信息
        List<Map<String,Object>> mapList = new ArrayList<Map<String,Object>>();

        // 超级管理员获取全部信息
        if (superAdmin > 0) {
            mapList = userService.getNamespaceAndTeam();
        } else {
            mapList = userService.getNamespaceAndTeamByUserId(userId);
        }

        //
        for (Map<String,Object> map : mapList) {
            String namespace_temp = (String) map.get("namespace");
            // 获取空间的应用数量
            long appCount = userService.getAppCountByNamespace(namespace_temp);
            // 获取应用的容器组数量
            int podCount = userService.getPodCountByNamespace(namespace_temp);
            map.put("appCount",appCount);
            map.put("podCount",podCount);
        }

        VenusResponse<Object> response = new VenusResponse<Object>(VenusResponseStatus.OK,"",mapList);
        return response;
    }


    /*
    * 得到用户的空间信息
    * */
    @ApiOperation(value = "得到用户的团队信息", notes = "用户ID,是否超级管理员")
    @RequestMapping(value = "/team/base", method = RequestMethod.GET)
    public VenusResponse<Object> getTeamBase(@RequestParam("userId") String userId,@RequestParam("superAdmin") int superAdmin) throws VenusException {
        if (StringUtils.isBlank(userId))
            throw new VenusException(VenusResponseStatus.NO_CONTENT, "用户ID为空");

        // 获取团队信息
        List<Map<String,Object>> mapList = new ArrayList<Map<String,Object>>();

        // 超级管理员获取全部信息
        if (superAdmin > 0) {
            mapList = userService.getTeamBase();
        } else {
            mapList = userService.getTeamBaseByUserId(userId);
        }

        // 获取团队空间数量,和对应的用户数量
        for (Map<String,Object> map : mapList) {
            String team_tamp = (String) map.get("team");
            Map<String,Object> countMap = userService.countNamespaceAndUserByTeam(team_tamp);
            Object namespace_num = 0;
            Object user_num = 0;
            if (countMap.size() > 0) {
                namespace_num = countMap.get("namespace_count");
                user_num = countMap.get("user_count");
            }
            map.put("namespace_num",namespace_num);
            map.put("user_num",user_num);
        }
        VenusResponse<Object> response = new VenusResponse<Object>(VenusResponseStatus.OK,"",mapList);
        return response;
    }

    /*
    * 根据用户的ID,修改手机号码
    * */
    @ApiOperation(value = "根据用户的ID,修改手机号码", notes = "根据用户的ID,修改手机号码")
    @RequestMapping(value = "/phone", method = RequestMethod.PATCH)
    public VenusResponse<String> editPhone(@RequestBody UserBean userBean) throws VenusException {
        String userId = userBean.getId();
        String phone = userBean.getPhone();
        if (StringUtils.isBlank(userId))
            throw new VenusException(VenusResponseStatus.NO_CONTENT, "用户ID为空");
        if (StringUtils.isBlank(phone))
            throw new VenusException(VenusResponseStatus.NO_CONTENT, "手机号码为空");
        int row = userService.editPhone(userId,phone);
        int code = VenusResponseStatus.OK ;
        String message = "修改手机号码,成功!";
        if(row == 0) {
            code = VenusResponseStatus.HANDLE_ERROR;
            message = "修改手机号码,失败";
        }
        VenusResponse<String> response = new VenusResponse<String>(code,message,"");
        return response;
    }

    /*
    * 根据用户的ID,修改邮箱
    * */
    @ApiOperation(value = "根据用户的ID,修改邮箱", notes = "根据用户的ID,修改邮箱")
    @RequestMapping(value = "/email", method = RequestMethod.PATCH)
    public VenusResponse<String> editEmail(@RequestBody UserBean userBean) throws VenusException {
        String userId = userBean.getId();
        String email = userBean.getEmail();
        if (StringUtils.isBlank(userId))
            throw new VenusException(VenusResponseStatus.NO_CONTENT, "用户ID为空");
        if (StringUtils.isBlank(email))
            throw new VenusException(VenusResponseStatus.NO_CONTENT, "邮箱为空");
        int row = userService.editEmail(userId,email);
        int code = VenusResponseStatus.OK ;
        String message = "修改邮箱,成功!";
        if(row == 0) {
            code = VenusResponseStatus.HANDLE_ERROR;
            message = "修改邮箱,失败";
        }
        VenusResponse<String> response = new VenusResponse<String>(code,message,"");
        return response;
    }



}